package com.upcoming.data.storm.fileRead;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.tuple.Fields;

/**
 * 作者：tianjiayuan
 * 创建时间：2018-05-23 9:49
 * 类描述：
 * 修改人：
 * 修改时间：
 */
// main com.upcoming.data.storm.fileRead.FileApp
public class FileApp {

    public static void main(String[] args) throws Exception{
        Config conf = new Config();
        conf.setDebug(false);
//        conf.setNumWorkers(2);
        conf.put("myfile", "E:\\bak.txt");
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("fileSpout", new FileSpout());
        builder.setBolt("fileBolt", new FileBolt(), 2).shuffleGrouping("fileSpout");
        builder.setBolt("wordBolt", new WordBolt()).fieldsGrouping("fileBolt", new Fields("word"));
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("fileAPP", conf, builder.createTopology());

        Thread.sleep(1000 * 60);

        cluster.shutdown();

//        StormSubmitter.submitTopology("wordCount", conf, builder.createTopology());
    }
}
